<template>
  <div class="common_big_photo">
    <!--<div class="big_photo_content">-->
    <mt-swipe @change="handleChange" :auto="0" :defaultIndex="getIndex">
      <mt-swipe-item :key="item.id" v-for="item in getData">
        <img :src="item.file_url" >
      </mt-swipe-item>
    </mt-swipe>
    <!--</div>-->

    <div class="photo_bottom">
      <div class="title">
        {{getName}}
      </div>
      <div class="index_number">
        {{$store.state.house.defaultIndex + 1}} / {{$store.state.house.photoContent.length}}
      </div>
    </div>
  </div>
</template>

<script>
  import Vue from 'vue'
  import {Swipe, SwipeItem} from 'mint-ui';

  Vue.component(Swipe.name, Swipe);
  Vue.component(SwipeItem.name, SwipeItem);
  export default {
    props: {

    },
    name: 'BigPhoto',
    data() {
      return {
      }
    },
    mounted() {

    },
    computed:{
      getData(){
        // window.alert('666');

        return this.$store.getters.getData;
      },
      getName(){
        return this.$store.getters.getName
      },
      getIndex(){
        return this.$store.getters.getIndex
      },
      // getphotoContent(){
      //   return this.$store.getters.photoContent
      // }
    },

    methods: {
      handleChange(index) {
        // console.log(this.getData);
        this.$store.commit('setIndex',index);
        // this.$store.state.house.defaultIndex = index;
        this.$store.commit('setName',this.$store.state.house.photoContent[index].file_name);
        // this.$store.commit('setName',this.getData[index].file_name);
        // this.$store.state.house.imageName = this.$store.state.house.photoContent[index].file_name;
      }
    }
  }
</script>

<style scoped>
  .common_big_photo {
    height: 300px;
    position: fixed;
    left: 0;
    bottom: 200px;
    width: 100%;
    font-size: 0.8rem;
    /*padding: 100px 0;*/
  }

  .common_big_photo img {
    width: 100%;
    height: 100%;
  }

  .common_big_photo .photo_bottom {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    background: #1b1b1b;
  }

  .common_big_photo .photo_bottom .title {
    color: #ffffff;
    height: 50px;
    line-height: 50px;

  }

  .common_big_photo .photo_bottom .index_number {
    width: 3rem;
    background: #aaa;
    height: 20px;
    margin: 15px 0;
    border-radius: 5px;
    opacity: 0.5;
    text-align: center;
    color: #ffffff;
  }

  .mint-swipe {
    margin-bottom: 100px;
  }
</style>
